package com.bristua.mall.user.biz;

import com.bristua.mall.common.bean.PageBean;
import com.bristua.mall.common.utils.CacheUtil;
import com.bristua.mall.user.dao.CountUserConsumptionRecordMapper;
import com.bristua.mall.user.model.TUser;
import com.bristua.mall.user.model.TUserAdress;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2019/3/27.
 */
@Service
public class CountUserIntegralDetailBiz {

    @Resource
    private CountUserConsumptionRecordMapper countUserConsumptionRecordMapper;

    @Autowired
    private CacheUtil cacheUtil;

    public PageBean countUserIntegralDetail(int pageNo,int pageSize){
        TUser userSession = (TUser) cacheUtil.getUserSession();
        String userId = userSession.getUserId();
        Page<Map> objects = PageHelper.startPage(pageNo,pageSize);
        List<Map> maps = countUserConsumptionRecordMapper.countUserIntegralDetail(userId);
        PageBean data = new PageBean<>(objects);
        return data;
    }
}
